﻿/* 2011/11/26 */
using System;
using System.Collections.Generic;
using System.Text;
using Cosmos.Shortcuts;

namespace PictureManager
{
    class MouseGestureExtant : ShortcutExecutant
    {
        public MouseGestureExtant(PictureManagerOperationCategory operation, params string[] arguments)
            : base(new ShortcutOperation((int)operation, arguments))
        {

        }

        public MouseGestureExtant(string escapeString)
            : base(escapeString)
        {

        }

        public bool Contains(MouseGesture mouseGesture)
        {
            foreach (IShortcutAction anAction in _shortcutActions)
            {
                MouseGesture currentMouseGesture = (MouseGesture)anAction;
                if (currentMouseGesture.Equals(mouseGesture))
                    return true;
            }
            return false;
        }

        public void Add(MouseGesture mouseGesture)
        {
            _shortcutActions.Add(mouseGesture);
        }

        public void Remove(MouseGesture mouseGesture)
        {
            if (_shortcutActions != null)
                _shortcutActions.Remove(mouseGesture);
        }

        public void RemoveAt(int index)
        {
            if (_shortcutActions != null)
                _shortcutActions.RemoveAt(index);
        }

        public void Clear()
        {
            if (_shortcutActions != null)
                _shortcutActions.Clear();
        }

        public IEnumerable<MouseGesture> MouseGestures
        {
            get
            {
                foreach (IShortcutAction anAction in _shortcutActions)
                {
                    yield return (MouseGesture)anAction;
                }
            }
        }
    }
}
